<%@ page language="java" import="java.util.*"
	contentType="text/html; charset=utf-8"%>
<!doctype html>

<html class="no-js">

<head>
<%@ include file="../commoms/link.txt"%>
<meta name="description" content="JobFinished">
<script src="assets/js/pagejs/JobFinished.js"></script>
</head>

<body>
	<%@ include file="../commoms/ERHeader.txt"%>

	
   <div class="admin-content">
    <div class="admin-content-body">
      <div class="am-cf am-padding am-padding-bottom-0">
        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">表格</strong> / <small>Table</small></div>
      </div>

      <hr>

      <div class="am-g">
        <div class="am-u-sm-12 am-u-md-6">
          <div class="am-btn-toolbar">
            <div class="am-btn-group am-btn-group-xs">
							<button type="button" id="add" class="am-btn am-btn-default">
								<span class="am-icon-plus"></span>新增
							</button>
						
							<button type="button" id="batchdelete"
								class="am-btn am-btn-default">
								<span class="am-icon-trash-o"></span> 删除
							</button>
            </div>
          </div>
        </div>
       
      </div>
        <div class="am-g">
        <div class="am-u-sm-12">
          <form class="am-form">
            <table class="am-table am-table-striped am-table-hover table-main">
              <thead>
               <tr>
                <th class="table-check"><input type="checkbox"  id="checkall" />
                </th><th class="table-id">ID</th><th class="table-title">工作名</th><th class="table-author am-hide-sm-only">工作待遇</th><th class="table-author am-hide-sm-only">工作类型</th><th class="table-date am-hide-sm-only">工作时间</th><th class="table-date am-hide-sm-only">发布时间</th><th class="table-set">操作</th>
              </tr>
              </thead>
							
					<tbody id="pagecontainer">

					</tbody>
				</table>
			    <div class="am-cf" id="num">
                      
              <div class="am-fr">
			<ul id="page" data-am-widget="pagination"
				class="am-pagination am-pagination-default">
			  </ul>
              </div>
            </div>
            <hr />
          </form>
        </div>

      </div>
    </div>

  </div>
  <%@ include file="../commoms/alert.txt"%>
</div>

		<script type="text/javascript">
			var currentpage = 1;
			var pages = 1;
			var $ul = $('#page');
			var $pagecontainer = $('#pagecontainer');
			var ldata = null;
			  var nums=0;
			$pagecontainer.on('click', '.del', function(event) {
				further('del', event.currentTarget.id)
			});
			$pagecontainer.on('click', '.restart', function(event) {
				further('restart', event.currentTarget.id)
			});

			$pagecontainer.on('click', '.view', function(event) {
				further('view', event.currentTarget.id)
			});
			myAjax(domain + "/getAllERCount.do", {}, function(
					data) {
				$('#count1').text(data.nostart);
				$('#count2').text(data.started+data.end);
				$('#count3').text(data.finish);
		        nums=data.finish;
					 $('#num').text('共'+nums+'条记录');
							pages = nums;
							pages = Math.ceil(pages / 5)
							if (nums != 0) {
								drawPages($ul, currentpage, pages, 10);
								getdiffstatuscontent(domain
										+ '/getDiffStatusPtJob.do', {
									'page' : currentpage,
									'status' : 29
								}, $pagecontainer);
							}
						});
				$("#checkall").change(function() { 
					if($("#checkall").prop('checked'))
					     $(".check").prop("checked","checked");
						else
							$(".check").prop("checked",false);
				
				}); 
					
				$pagecontainer.on('click', '.check', function(event) {
					
					if (!$('#'+event.currentTarget.id).is(':checked'))
						$("#checkall").prop("checked", false);
				});
				$("#add").click(function() {
					window.location.href = "/Job-Posted.jsp";

				});
			
				$("#batchdelete").click(function() {
					var id = '?';
					$.each(ldata, function(i, item) {
						if ($('#check' + i).is(':checked'))
							id += 'id=' + item.id+'&';
					});

					if (id != '?') {
						id=id.substring(0,id.length-1);
						myAjax('/batching/delete.do'+id, {}, function(data) {
		                  if(data.state=='success')
		                	  myAlert('提示','操作成功');
		                  window.location.href='/JobFinished.jsp';
						});
					}
					else
						myAlert('提示','请选择操作的工作');
				});
		</script>
	
	

	<a href="#"
		class="am-icon-btn am-icon-th-list am-show-sm-only admin-menu"
		data-am-offcanvas="{target: '#admin-offcanvas'}"></a>


</body>
</html>
